<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>节点的层次关系访问节点</title>
		<script>
		function changeh1(){
			var p=document.getElementById("adv");
			var h1=p.previousElementSibling;
			console.log(h1.nodeType);
			console.log(h1.nodeName);
			h1.innerHTML="贪玩蓝月"+new Date();
			
			var h2=p.nextElementSibling;
			h2.innerHTML="一刀999";
		}
		</script>
	</head>
	<body>
		<h1>We change lies</h1>
		<p id="adv">
			大扎好，我是渣渣灰
		</p>
		<h2>教育改变生活</h2>
		<p>
			<button type="button" onclick="changeh1()">访问h1</button>
		</p>
	</body>
</html>
